package cn.richard.demo.ruleengine.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
public class EasyRuleConfigChangedListener extends AbsNacosPropertiesConfigListener{
	@Autowired
	private RuleFireService ruleFireService;
	
	@Override
	protected String getDataId(Environment env) {
		
		return env.getProperty("easyrules.ext-config.data-id");
	}

	@Override
	protected String getGroup(Environment env) {
		
		return env.getProperty("easyrules.ext-config.group");
	}

	@Override
	protected String getNamespace(Environment env) {
		
		return env.getProperty("easyrules.ext-config.namespace");
	}

	@Override
	protected void onConfigInfoChanged() {
		ruleFireService.refreshRules();
	}

}
